/*
This file is part of maven-bugzilla-plugin.

    maven-bugzilla-plugin is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    maven-bugzilla-plugin is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with maven-bugzilla-plugin.  If not, see <http://www.gnu.org/licenses/>.
 */
package nl.semlab.maven.plugin.bugzilla;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.project.MavenProject;

import nl.semlab.maven.plugin.bugzilla.exceptions.BugzillaException;
import nl.semlab.maven.plugin.bugzilla.model.BugzillaWebservice;

/**
 * This class is the abstract super class of all Bugzilla mojo's. It contains
 * the general configuration options.
 * <p />
 * Project maven-bugzilla-plugin<br />
 * AbstractBugzillaMojo.java created 09 Apr 2009
 * <p />
 * Copyright &copy 2009 SemLab
 * 
 * @author <a href="mailto:borsje@semlab.nl">J.A. Borsje</a>
 * @version $Revision: 1.2 $, $Date: 2009-08-31 14:23:05 $
 */
public abstract class AbstractBugzillaMojo extends AbstractMojo
{
   /**
    * The Bugzilla server address.
    * 
    * @parameter
    */
   protected String server;

   /**
    * The user name used to login to Bugzilla.
    * 
    * @parameter
    */
   protected String user;

   /**
    * The password used to login to Bugzilla.
    * 
    * @parameter
    */
   protected String pass;

   /**
    * The name of the product in Bugzilla which represents this project.
    * 
    * @parameter
    */
   protected String product;

   /**
    * @parameter expression="${project.version}"
    */
   protected String version;

   /**
    * The Bugzilla webservice connection.
    */
   protected BugzillaWebservice webservice;

   /**
    * @parameter expression="${project}"
    * @required
    * @readonly
    */
   protected MavenProject project;

   /**
    * Create the Bugzilla Mojo.
    */
   public AbstractBugzillaMojo()
   {
      super();
   }

   /**
    * @throws BugzillaException
    *            Thrown if the url to the server could not be created.
    */
   protected void init() throws BugzillaException
   {
      this.getLog().debug("Initializing maven-bugzilla-plugin");
      webservice = new BugzillaWebservice(super.getLog(), server, user, pass);
   }
}